from __future__ import division

def sqrt(x, guess=None):
    if guess is None:
        guess = x / 2
    if abs((x / guess) - guess) < (x / 1e6):
        return guess
    else:
        guess = (guess + x /guess) / 2
        return sqrt(x, guess)

    